package com.xiaotao.learn.thread.pool;

import java.util.concurrent.*;

public class PoolLearn {
    public static void main(String[] args) throws InterruptedException {
        ExecutorService executor = new ThreadPoolExecutor(
                0, 5,
                60, TimeUnit.SECONDS,
                new SynchronousQueue<>()
        );
        for (int i = 0; i < 5; i++) {
            executor.submit(() -> {
                System.out.println(Thread.currentThread().getName() + ":Hello World");
            });
        }
        executor.awaitTermination(1, TimeUnit.DAYS);
        executor.shutdown();

    }
}
